Move m241 to its own type instead of a barnacle on mtk.
authorrobertl <robertl>
Wed, 14 May 2008 15:54:55 +0000 (15:54 +0000)
committerrobertl <robertl>
Wed, 14 May 2008 15:54:55 +0000 (15:54 +0000)
configure
configure.in
gbversion.h
mtk_logger.c
testo
vecs.c
xmldoc/formats/m241-bin.xml [new file with mode: 0644]
xmldoc/formats/m241.xml [new file with mode: 0644]

index ba89b6b49e2357a1bc5e3e9d5b67fe6f302a4b46..4e3ea62e6b5349491243f448bacb7aeccbfc2b35 100755 (executable)
--- a/configure
+++ b/configure
@@ -1746,7 +1746,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 # Increase GBBUILD for a new release
 GBBUILD=16
 # YYYYMMDD, please, if beta, i.e. "-beta20060413"
-# PACKAGE_RELEASE="-beta20080305"
+PACKAGE_RELEASE="-beta20080514"
 
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_RELEASE "$PACKAGE_RELEASE"
@@ -1756,7 +1756,7 @@ _ACEOF
 
 DOCVERSION=`echo $PACKAGE_VERSION`
 DOCVERSION=development
-DOCVERSION=1.3.5
+DOCVERSION=1.3.5
 
 
 GBMAJOR=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $major)`
index 15982033c9ae3b4d4bd7a663475429c8e28a2318..50701149cb0c2ddeb3a9f6495043560ff2f1fce5 100644 (file)
@@ -7,13 +7,13 @@ AC_INIT(GPSBabel, 1.3.5, BUG-REPORT-ADDRESS)
 # Increase GBBUILD for a new release
 GBBUILD=16
 # YYYYMMDD, please, if beta, i.e. "-beta20060413"
-# PACKAGE_RELEASE="-beta20080305"
+PACKAGE_RELEASE="-beta20080514"
 AC_DEFINE_UNQUOTED(PACKAGE_RELEASE, "$PACKAGE_RELEASE", [Define to the release name of this package.])
 AC_SUBST(PACKAGE_RELEASE)
 
 DOCVERSION=`echo $PACKAGE_VERSION`
 DOCVERSION=development
-DOCVERSION=1.3.5   
+DOCVERSION=1.3.5   
 AC_SUBST(DOCVERSION)
 
 GBMAJOR=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $major)`
index 070161cadb393659ebd0d0740c942ccb3c7c4cb4..5ab54b9f5f0df1e8f947bc21a33686541c4d8de6 100644 (file)
@@ -4,5 +4,5 @@
  *
  * Isn't simplification via automation grand?
  */
-#define VERSION "1.3.5"
-#define WEB_DOC_DIR "http://www.gpsbabel.org/htmldoc-1.3.5"
+#define VERSION "1.3.5-beta20080514"
+#define WEB_DOC_DIR "http://www.gpsbabel.org/htmldoc-development"
index 799a58cf994c2d408516a27b1d02e687bddffe4a..39428e71dd61cc2149bb3c1c1e1aeaf7000f38f8 100644 (file)
@@ -190,8 +190,7 @@ static FILE *fl;  /* bin.file fd */
 static char *port; /* serial port name */
 static char *erase;  /* erase ? command option */
 static char *csv_file; /* csv ? command option */
-static char *m241;  /* m241 ? command option */
-#define IS_M241 (m241 && (*m241 != '0'))
+static int is_m241=0;
 
 static unsigned int bmask = 0x000e0e7f;
 static unsigned int mlog_period, mlog_distance, mlog_speed; /* in 10:ths of sec, m, km/h */
@@ -207,12 +206,12 @@ const char CMD_LOG_FORMAT[] = "$PMTK182,2,2*39\r\n";
 const char CMD_LOG_ERASE[]  = "$PMTK182,6,1*3E\r\n";
 
 
+static void mtk_rd_init(const char *fname);
 static void file_init(const char *fname);
 static void file_deinit(void) ;
 static void file_read(void);
 
 
-
 // Arguments for logg fetch 'mtk' command..
 
 static arglist_t mtk_sargs[] = {
@@ -220,8 +219,6 @@ static arglist_t mtk_sargs[] = {
         "0", ARGTYPE_BOOL, ARG_NOMINMAX },
     { "csv",   &csv_file, "MTK compatible CSV output file",
         NULL, ARGTYPE_STRING, ARG_NOMINMAX },
-    { "m241",  &m241, "Special support for HOLUX M-241 Logger",
-        "0", ARGTYPE_BOOL, ARG_NOMINMAX },
     ARG_TERMINATOR
 };
 
@@ -331,6 +328,10 @@ static int do_cmd(const char *cmd, const char *expect, time_t timeout_sec) {
 /*******************************************************************************
 * %%%        global callbacks called by gpsbabel main process              %%% *
 *******************************************************************************/
+static void mtk_rd_init_m241 (const char *fname) {
+    is_m241 = 1;
+    mtk_rd_init(fname);
+}
 
 static void mtk_rd_init(const char *fname){
     int rc;
@@ -345,7 +346,7 @@ static void mtk_rd_init(const char *fname){
     // verify that we have a MTK based logger...
     dbg(1, "Verifying MTK based device...\n");
 
-    if ( IS_M241 ) {
+    if ( is_m241 ) {
        log_type[LATITUDE].size = log_type[LONGITUDE].size = 4;
        log_type[HEIGHT].size = 3;
        rc = gbser_set_port(fd, MTK_BAUDRATE_M241, 8, 0, 1);
@@ -791,7 +792,7 @@ int mtk_parse(unsigned char *data, int dataLen, unsigned int bmask){
             }
             break;
         case 1<<HEIGHT:
-            if ( IS_M241 ) {
+            if ( is_m241 ) {
                unsigned char tmp[4];
                tmp[0] = 0x0;
                tmp[1] = *(data + i);
@@ -902,7 +903,7 @@ int mtk_parse(unsigned char *data, int dataLen, unsigned int bmask){
       }
    } /* for (bmap,...) */
  
-   if ( ! IS_M241 && ( data[i] != '*') ) {
+   if ( ! is_m241 && ( data[i] != '*') ) {
       if ( global_opts.debug_level > 0 ) {
          int j;
          printf("Missing '*' !\n");
@@ -915,7 +916,7 @@ int mtk_parse(unsigned char *data, int dataLen, unsigned int bmask){
          return 16;
       }
    }
-   if ( ! IS_M241 ) i++; // skip '*' separator
+   if ( ! is_m241 ) i++; // skip '*' separator
 
    if ( data[i] != crc ){
       printf("%2d: Bad CRC %.2x != %.2x\n", count, data[i], crc);
@@ -949,7 +950,7 @@ static int mtk_parse_info(const unsigned char *data, int dataLen){
          case 0x02:
             bm = le_read32(data + 8);
             dbg(1, "# Log bitmask is: %.8x\n", bm);
-            if ( IS_M241 ) 
+            if ( is_m241 ) 
                bm &= 0x7fffffffU;
             if ( bmask != bm )
                dbg(1," ########## Bitmask Change   %.8x -> %.8x ###########\n", bmask, bm);
@@ -997,12 +998,17 @@ static int mtk_parse_info(const unsigned char *data, int dataLen){
 
 /********************** File-in interface ********************************/
 
+static void file_init_m241(const char *fname) {
+    is_m241=1;
+    file_init(fname);
+}
+
 static void file_init(const char *fname) {
     dbg(4, "Opening file %s...\n", fname);
     if (fl = fopen(fname, "rb"), NULL == fl) {
         fatal(MYNAME ": Can't open file '%s'\n", fname);
     }
-    if ( IS_M241 ) {
+    if ( is_m241 ) {
        log_type[LATITUDE].size = log_type[LONGITUDE].size = 4;
        log_type[HEIGHT].size = 3;
     }
@@ -1014,7 +1020,7 @@ static void file_deinit(void) {
 }
 
 static int is_holux_string(const unsigned char *data, int dataLen) {
-   if ( IS_M241 &&
+   if ( is_m241 &&
         dataLen >= 5 &&
         data[0] == (0xff & 'H') &&
         data[1] == (0xff & 'O') &&
@@ -1062,7 +1068,7 @@ static void file_read(void) {
       unsigned int mask, log_period, log_distance, log_speed;
        
       mask = le_read32(buf + 2);
-      if ( IS_M241 ) {
+      if ( is_m241 ) {
          // clear Holux-specific 'low precision' bit
          mask &= 0x7fffffffU;
       }
@@ -1182,13 +1188,30 @@ ff_vecs_t mtk_vecs = {
                                                /* not fixed, can be changed through command line parameter */
 };
 
+ff_vecs_t mtk_m241_vecs = {
+       ff_type_serial,
+       { 
+               ff_cap_none     /* waypoints */, 
+               ff_cap_read     /* tracks */, 
+               ff_cap_none     /* routes */
+       },
+       mtk_rd_init_m241,       
+       NULL,   
+       mtk_rd_deinit,  
+       NULL,   
+       mtk_read,
+       NULL,
+       NULL,
+       mtk_sargs,
+       CET_CHARSET_ASCII, 0                    /* ascii is the expected character set */
+                                               /* not fixed, can be changed through command line parameter */
+};
+
 /* used for mtk-bin */
 
 static arglist_t mtk_fargs[] = {
     { "csv",   &csv_file, "MTK compatible CSV output file",
         NULL, ARGTYPE_STRING, ARG_NOMINMAX },
-    { "m241",  &m241, "Special support for HOLUX M-241 Logger",
-        "0", ARGTYPE_BOOL, ARG_NOMINMAX },
     ARG_TERMINATOR
 };
 
@@ -1205,5 +1228,19 @@ ff_vecs_t mtk_fvecs = {
     mtk_fargs,
     CET_CHARSET_UTF8, 1         /* master process: don't convert anything | CET-REVIEW */
 };
+
+ff_vecs_t mtk_m241_fvecs = {
+    ff_type_file,
+    { ff_cap_none, ff_cap_read, ff_cap_none },
+    file_init_m241,
+    NULL,
+    file_deinit,
+    NULL,
+    file_read,
+    NULL,
+    NULL, 
+    mtk_fargs,
+    CET_CHARSET_UTF8, 1         /* master process: don't convert anything | CET-REVIEW */
+};
 /* End file: mtk_logger.c */
 /**************************************************************************/
diff --git a/testo b/testo
index 2b5c06e9d32b321ea7bbe5875878b9719f3341ec..77768d349167588c4fb9a653f7113ff64cfe0cf3 100755 (executable)
--- a/testo
+++ b/testo
@@ -1301,7 +1301,7 @@ compare ${TMPDIR}/mtk_logger.csv ${REFERENCE}/track/mtk_logger.csv
 # MTK logger tests (Holux M-241)
 #
 rm -f ${TMPDIR}/mtk_logger_m241.*
-${PNAME} -t -w -i mtk-bin,m241,csv=${TMPDIR}/mtk_logger_m241.csv -f ${REFERENCE}/track/mtk_logger_m241.bin -o gpx -F ${TMPDIR}/mtk_logger_m241.gpx
+${PNAME} -t -w -i m241-bin,csv=${TMPDIR}/mtk_logger_m241.csv -f ${REFERENCE}/track/mtk_logger_m241.bin -o gpx -F ${TMPDIR}/mtk_logger_m241.gpx
 compare ${TMPDIR}/mtk_logger_m241.gpx ${REFERENCE}/track/mtk_logger_m241.gpx
 ## CSV compare needs to be done with '-w' - ignore whitespace.
 compare ${TMPDIR}/mtk_logger_m241.csv ${REFERENCE}/track/mtk_logger_m241.csv
diff --git a/vecs.c b/vecs.c
index c091ae4351a7d7c009cf15aec90c5ad5a3503b63..86b8bd9692820bbc87e7db9de26d3698aacc5be0 100644 (file)
--- a/vecs.c
+++ b/vecs.c
@@ -81,6 +81,8 @@ extern ff_vecs_t mps_vecs;
 extern ff_vecs_t msroute_vecs;
 extern ff_vecs_t mtk_vecs;
 extern ff_vecs_t mtk_fvecs;
+extern ff_vecs_t mtk_m241_vecs;
+extern ff_vecs_t mtk_m241_fvecs;
 extern ff_vecs_t navicache_vecs;
 extern ff_vecs_t netstumbler_vecs;
 extern ff_vecs_t nmea_vecs;
@@ -432,6 +434,18 @@ vecs_t vec_list[] = {
                 "MTK Logger (iBlue 747,...) Binary File Format",
                 "bin"
         },
+        {
+                &mtk_m241_vecs,
+                "m241",
+                "Holux M-241 (MTK based) download",
+                NULL
+        },
+        {
+                &mtk_m241_fvecs,
+                "m241-bin",
+                "Holux M-241 (MTK based) Binary File Format",
+                "bin"
+        },
         {
                 &wbt_svecs,
                 "wbt",
diff --git a/xmldoc/formats/m241-bin.xml b/xmldoc/formats/m241-bin.xml
new file mode 100644 (file)
index 0000000..d56097b
--- /dev/null
@@ -0,0 +1,12 @@
+<para>
+       The Holux m241 is a small datalogger using the MTK chipset, with 
+       a couple small differences in the binary format. In its default 
+       configuration, it can store ~100000 trackpoints with very limited
+        data; to configure extended logging you can use the BT747 open 
+       source software 
+         <ulink url="http://bt747.wiki.sourceforge.net">bt747</ulink>
+        Waypoint storage is possible only if RCR is enabled in the settings.
+</para>
+<para>
+       Use the m241 format to connect with the unit serially and m241-bin to read files saved by the device.
+</para>
diff --git a/xmldoc/formats/m241.xml b/xmldoc/formats/m241.xml
new file mode 100644 (file)
index 0000000..d56097b
--- /dev/null
@@ -0,0 +1,12 @@
+<para>
+       The Holux m241 is a small datalogger using the MTK chipset, with 
+       a couple small differences in the binary format. In its default 
+       configuration, it can store ~100000 trackpoints with very limited
+        data; to configure extended logging you can use the BT747 open 
+       source software 
+         <ulink url="http://bt747.wiki.sourceforge.net">bt747</ulink>
+        Waypoint storage is possible only if RCR is enabled in the settings.
+</para>
+<para>
+       Use the m241 format to connect with the unit serially and m241-bin to read files saved by the device.
+</para>